package eu.jpereira.trainings.designpatterns.structural.facade;
import static org.mockito.Mockito.*;
import eu.jpereira.trainings.designpatterns.structural.facade.model.DispatchReceipt;
import eu.jpereira.trainings.designpatterns.structural.facade.model.Order;
import eu.jpereira.trainings.designpatterns.structural.facade.service.BookDBService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerNotificationService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.OrderingService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.WharehouseService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerDBService ;
public class DefaultBookstoreFacade implements BookstoreFacade{

	private CustomerDBService customerService;
	private WharehouseService wharehouseService;
	private BookDBService bookService;
	private OrderingService orderingService;
	private CustomerNotificationService customerNotificationService;
	@Override
	public void placeOrder(String customerId, String isbn) {

		DispatchReceipt dr = wharehouseService.dispatch(this.orderingService.createOrder(customerService.findCustomerById(customerId),this.bookService.findBookByISBN(isbn)));
		customerNotificationService.notifyClient(dr);
		
	}
	
	public void setCustomerService(CustomerDBService customerService)
	{
		this.customerService = customerService;
	}
	public void setWarehouseService(WharehouseService wharehouseService){
		 this.wharehouseService =wharehouseService;
	}
	public void setBookService( BookDBService bookService)
	{
		this.bookService = bookService;
	}
	public void setOrderingService(OrderingService orderingService){
		this.orderingService = orderingService;
	}
	public void setCustomerNotificationService (CustomerNotificationService customerNotificationService){
		this.customerNotificationService = customerNotificationService;
	}

	
}